﻿﻿using System;

namespace cz.zcu.PreSti.Components
{
    public class ExitPoint : RunnableComponent
    {
        private Subdiagram diagram;

        public ExitPoint(IPresentation p, Subdiagram diagram = null)
            : base(p)
        {
            this.diagram = diagram;
            Finished += new EventHandler(onFinished);
        }

        #region parameters

        public Subdiagram Diagram
        {
            get
            {
                return diagram;
            }
            set
            {
                diagram = value;
            }
        }

        #endregion

        public override void update() { }

        public new void trigIn(int n) { }

        private void onFinished(object sender, EventArgs e)
        {
            if (diagram != null) diagram.finish(this);
        }
    }
}